<template>
    <div class="download-list d-inline-block relative">
        <span v-for="val in file_list" :key="val.id" class="mr-1 pointer color-t1" @click="download(val.path)">
            {{val.name}}
        </span>
    </div>
</template>

<script>
    export default {
        props:['file_list'],
        methods:{
            download(url){
                if(url){
                    this.$Spin.show({
                        render: (h) => {
                            return h('div', [
                                h('Icon', {
                                    'class': 'rotate-loading',
                                    props: {
                                        type: 'ios-loading',
                                        size: 18
                                    }
                                }),
                                h('div', '下载中')
                            ])
                        }
                    });
                    this.download_run(this.$domain+url)
                }
                
            }
        },
        beforeDestroy(){
            this.$ipcRenderer.removeListener('download-complete',Function())
        },
        mounted(){
            this.$ipcRenderer.on('download-complete',()=>{
                this.$Spin.hide();
            })
        }
    }
</script>